home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / m_to_r / prtrep41 / demo5.pa_ / demo5.bin
Encoding:
Text File  |  1996-09-15  |  2.2 KB  |  94 lines

  1. unit Demo5;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   StdCtrls, Forms, DBCtrls, DB, DBGrids, Buttons, DBTables, Grids,
  8.   ExtCtrls, Printers, PrnGridR;
  9.  
  10. type
  11.   TDemo5Form = class(TForm)
  12.     DBGrid1: TDBGrid;
  13.     Panel1: TPanel;
  14.     DataSource1: TDataSource;
  15.     Panel2: TPanel;
  16.     Query1: TQuery;
  17.     Label1: TLabel;
  18.     Style1: TBitBtn;
  19.     Exit: TBitBtn;
  20.     Query1PartNo: TFloatField;
  21.     Query1VendorNo: TFloatField;
  22.     Query1Description: TStringField;
  23.     Query1OnHand: TFloatField;
  24.     Query1OnOrder: TFloatField;
  25.     Query1Cost: TCurrencyField;
  26.     Query1ListPrice: TCurrencyField;
  27.     PrintGridReport1: TPrintGridReport;
  28.     Style2: TBitBtn;
  29.     Style3: TBitBtn;
  30.     Style4: TBitBtn;
  31.     Style5: TBitBtn;
  32.     procedure FormCreate(Sender: TObject);
  33.     procedure Style1Click(Sender: TObject);
  34.     procedure Style2Click(Sender: TObject);
  35.     procedure Style3Click(Sender: TObject);
  36.     procedure Style4Click(Sender: TObject);
  37.     procedure Style5Click(Sender: TObject);
  38.   private
  39.     { private declarations }
  40.   public
  41.   end;
  42.  
  43. var
  44.   Demo5Form: TDemo5Form;
  45.  
  46. implementation
  47.  
  48. {$R *.DFM}
  49.  
  50. procedure TDemo5Form.FormCreate(Sender: TObject);
  51. begin
  52.   Query1.Open;
  53.  
  54.   { SubTotals will be on field VenderNo}
  55.   PrintGridReport1.SetSubTotalField(1, 'VendorNo');
  56.  
  57.   { Do not total next 3 fields, but do all the rest  }
  58.   PrintGridReport1.SetPrintTotal('Cost', False);
  59.   PrintGridReport1.SetPrintTotal('ListPrice', False);
  60.   PrintGridReport1.SetPrintTotal('VenderNo', False);
  61. end;
  62.  
  63. procedure TDemo5Form.Style1Click(Sender: TObject);
  64. begin
  65.     PrintGridReport1.ReportStyle := rsColumns;
  66.     PrintGridReport1.Execute;
  67. end;
  68.  
  69.  
  70. procedure TDemo5Form.Style2Click(Sender: TObject);
  71. begin
  72.     PrintGridReport1.ReportStyle := rsClassic;
  73.     PrintGridReport1.Execute;
  74. end;
  75.  
  76. procedure TDemo5Form.Style3Click(Sender: TObject);
  77. begin
  78.     PrintGridReport1.ReportStyle := rsThinLines;
  79.     PrintGridReport1.Execute;
  80. end;
  81.  
  82. procedure TDemo5Form.Style4Click(Sender: TObject);
  83. begin
  84.     PrintGridReport1.ReportStyle := rsThickLines;
  85.     PrintGridReport1.Execute;
  86. end;
  87.  
  88. procedure TDemo5Form.Style5Click(Sender: TObject);
  89. begin
  90.     PrintGridReport1.ReportStyle := rsMiddle;
  91.     PrintGridReport1.Execute;
  92. end;
  93.  
  94. end.